home *** CD-ROM | disk | FTP | other *** search
/ The Atari Compendium / The Atari Compendium (Toad Computers) (1994).iso / files / prgtools / programm.ing / ams__l~1.zoo / man / joystick.man < prev    next >
Encoding:
Text File  |  1993-09-05  |  2.9 KB  |  100 lines

  1.                         ATARI MACHINE SPECIFIC LIBRARY
  2.  
  3.  
  4.  
  5. NAME
  6.      Joystick - access to standard Atari joysticks
  7.  
  8. SYNOPSIS
  9.      #include <Joystick.h>
  10.  
  11.      enum JoystickDirection
  12.      class Joystick
  13.  
  14. DESCRIPTION
  15.      The standard Atari joysticks are basicaaly four switches indicating
  16.      Up, Down, Left, and Right.  Diagonals are achieved by combinations
  17.      of pairs of these, such as Up-Left.  When devices other than normal
  18.      joysticks are connected, it is possible to have "directions" such
  19.      as Up-Down, or even Up-Down-Left-Right.  Joysticks also have a single
  20.      trigger switch (even if the physical joystick may have multiple
  21.      trigger buttons).
  22.  
  23. CLASSES
  24.      A Joystick class object represents fairly exactly the physical stick.
  25.  
  26. CLASS MEMBERS
  27.   Joystick::
  28.      Joystick(int port=1)
  29.        Create a joystick representing the stick connected to the left or
  30.        right joystick port (default is right).
  31.  
  32.      bool Up()
  33.        TRUE if the joystick is pushed up (or up-left, up-right, etc.)
  34.  
  35.      bool Down()
  36.        TRUE if the joystick is pushed down (or down-left, down-right, etc.)
  37.  
  38.      bool Left()
  39.        TRUE if the joystick is pushed left (or up-left, down-left, etc.)
  40.  
  41.      bool Right()
  42.        TRUE if the joystick is pushed right (or down-right, up-right, etc.)
  43.  
  44.      bool Trigger()
  45.        TRUE if the joystick trigger is pushed down.
  46.  
  47.      int X()
  48.      int Y()
  49.        -1, 0, or +1 interpretation of joystick, eg. if Stick.Up() == TRUE,
  50.        then Stick.Y() == -1.
  51.  
  52.      JoystickDirection Way()
  53.        Returns the direction of the joystick.
  54.  
  55.      bool Passive()
  56.        TRUE iff the joystick is not pushed in any direction, and the
  57.        trigger is not pressed.
  58.  
  59. USAGE
  60.      Simply declare a joystick, then use it.  When it goes out of scope,
  61.      it will revert to the previous state.  For example, if you declare
  62.      Joystick(0), you cannot use the mouse (which shares that port) until
  63.      theat stick goes out of scope.
  64.  
  65. EXAMPLES
  66.      Joystick stick;
  67.      Sprite ship("ship.spr");
  68.  
  69.      while (!stick.Trigger()) {
  70.        ship.MoveBy(stick.X(),stick.Y());
  71.        ship.Wipe();
  72.        ship.Draw();
  73.        Pages->Flip();
  74.      }
  75.  
  76.      (Of course, here we have not set-up the double buffer, or checked the
  77.      bounds of the sprite to keep it from going off the screen!).
  78.  
  79. SEE ALSO
  80.      Mouse
  81.  
  82. BUGS
  83.      The trigger on the right stick is equivalent to the right mouse button.
  84.      This is a hardware thing that cannot be overcome in software.
  85.  
  86. AUTHOR
  87.      Warwick Allison, 1992.
  88.      warwick@cs.uq.oz.au
  89.  
  90. COPYING
  91.      This functionality is part of the Atari Machine Specific Library,
  92.      and is Copyright 1992 by Warwick W. Allison.
  93.  
  94.      The Atari Machine Specific Library is free and protected under the
  95.      GNU Library General Public License.
  96.  
  97.      You are free to copy and modify these sources, provided you acknowledge
  98.      the origin by retaining this notice, and adhere to the conditions
  99.      described in the GNU LGPL.
  100.